package com.zzn.bookManage;

import com.zzn.bookManage.service.UserService;
import com.zzn.bookManage.util.ObjectHolder;

import java.nio.charset.StandardCharsets;
import java.util.*;

public class Starter {
    public static void main(String[] args) {
        UserService userService = ObjectHolder.getInstance().getUserService();
//        List<User> users = userService.listUsers();
//        for (User u:users){
//            System.out.println(u);
//        }
//        User zzn = new User();
//        zzn.setNickname("ZZN");
//        zzn.setUsername("zzn");
//        zzn.setPassword("1234");
//        userService.registerUser(zzn);
//        System.out.println(userService.loginUser(zzn));
//        users = userService.listUsers();
//        for (User u:users){
//            System.out.println(u);
//        }
//
        String username = "张子宁";
        String encoded = Base64.getEncoder().encodeToString(username.getBytes(StandardCharsets.UTF_8));
        System.out.println(encoded);
        String decoded = new String(Base64.getDecoder().decode(encoded));
        System.out.println(decoded);
    }
}
